JavaScript

A5.u.elementsetContentRetain Method

Syntax

A5.u.element.setContentRetain(element[,settings])

Arguments

elementelementstring

A pointer to a DOM element or the ID of an element.

settingsobject

The settings to use for the retained element.

autoHideboolean

If set to true then the element will be automatically hidden when it is retained. The default value of false will not hide the element.

onBeforeRetainfunction

A function to call before the element is removed from the DOM in order for it to be retained. The "this" scope of the function is the element being retained.

onRetainfunction

A function to call when the element has been inserted into the DOM in after it has been retained. The "this" scope of the function is the element being retained.

Description

Sets an element to be retained when A5.u.element.setContent is used on a parent of the element.

Discussion

Using A5.u.element.setContentRetain() allows for the retention of elements when a parent elements content is set with A5.u.element.setContent. This is useful as it allows for arbitrary elements to be kept when the majority of the content of an element is being replaced.

Example

// assume "id" is the ID of an element in an element A5.u.element.setContent will be used on
// assume "lCont" is a A5.ListBox control that is inside the retained element
A5.u.element.setContentRetain(id,{
	autoHide: false,
	onRetain: function(){
		lCont.refresh(); // force the child list of the contained element to be refreshed
	}
});